using System;
using System.Collections.Generic;
using System.Text;

namespace MySHQ.DAL
{
    public class ShopExtManager
    {
        private NHibernate.ISession _session;
        protected NHibernate.ISession Session { get { return _session; } set { _session = value; } }

        public ShopExtManager() 
        {
            Session = SessionManager.GetCurrentSession();
        }

        public void Update(MySHQ.Model.Entities.TabShopExt shopExt)
        {
            _session.Update(shopExt);
            _session.Flush();
        }

        public int Add(MySHQ.Model.Entities.TabShopExt shopExt)
        {
            int newId = (int)_session.Save(shopExt);
            _session.Flush();
            return newId;
        }

        public void Delete(MySHQ.Model.Entities.TabShopExt shopExt)
        {
            _session.Delete(shopExt);
            _session.Flush();
        }

        public MySHQ.Model.Entities.TabShopExt GetById(int shopId)
        {
            return _session.Get<MySHQ.Model.Entities.TabShopExt>(shopId);
        }
    }
}
